package com.yanqu.road.server.manager.activity.commonsupport.handler;

import com.yanqu.road.logic.helper.UnionActivityGroupHelper;
import com.yanqu.road.server.manager.activity.peakseacraft.PeakSeacraftActivity;
import com.yanqu.road.server.manager.activity.peakseacraft.PeakSeacraftMgr;
import com.yanqu.road.server.manager.activity.peakseacraft.PeakSeacraftUnionInfo;
import com.yanqu.road.server.manager.union.activitygroup.Cross2UnionActivityGroupMgr;

/**
 * 巅峰海上争霸
 */
public class PeakSeacraftActivitySupportHandler extends SupportActivityHandler {

    @Override
    public boolean ableUnion(int activityId, int groupId, String unionUid) {
        PeakSeacraftActivity activity = PeakSeacraftMgr.getPeakSeacraftActivity(activityId, groupId);
        if(activity != null){
            PeakSeacraftUnionInfo unionInfo = activity.getUnionInfo(unionUid, false);
            if(unionInfo != null){
                return true;
            }
        }
        return false;
    }

    @Override
    public boolean ableUser(int activityId, int groupId, long userId) {
        int unionGroup = Cross2UnionActivityGroupMgr.getGroupId(activityId, userId);
        return UnionActivityGroupHelper.NO_GROUP_ID != unionGroup;
    }
}
